import requests

class Base:
    def __init__(self):
        self.url = 'http://10.59.9.12:7001'
        self.session = requests.session()
        self.session.headers.update({'Content-Type':'application/json'})

    def request(self,method,path,**kwargs):
        url = f"{self.url}{path}"
        print(f"\n发送{method}请求:{url}")
        response = self.session.request(method,url,**kwargs)
        print(f"响应状态码:{response.status_code}")
        return response

    def get(self,path,**kwargs):
        return self.request("GET",path,**kwargs)

    def post(self,path,**kwargs):
        return self.request("POST",path,**kwargs)

    def put(self,path,**kwargs):
        return self.request("PUT",path,**kwargs)

    def delete(self,path,**kwargs):
        return self.request("DELETE",path,**kwargs)